package com.heima.stroke.handler.valuation;

//油钱
public class FuelCostValuation implements Valuation {

    private Valuation valuation;

    private float fuelPrice=1.0F;

    public FuelCostValuation(Valuation valuation) {
        this.valuation = valuation;
    }

    @Override
    //计费规则：3公里以内起步价13元；3公里以上2.3元/公里；燃油附加费1次收取1元
    public float calculation(float km) {
        float beforeCost=(valuation==null? 0f: valuation.calculation(km));
        if (km<=3){
            return beforeCost;
        }
        return beforeCost+fuelPrice;
    }
}
